import os

import shutil
from option import parse_args

if __name__ == '__main__':
    args = parse_args()
    diffs = os.path.join(args.root_dir, 'diffs')
    crops = os.path.join(args.root_dir, 'crops')
    videos = open('unaligned_videos_statistics.dat').readlines()
    for video_name in videos:
        video_split = video_name.split('.')
        if len(video_split) != 2:
            continue
        # Remove diff
        diff_video_path = os.path.join(diffs, video_split[0])
        if os.path.exists(diff_video_path):
            shutil.rmtree(diff_video_path)
        # Remove crop
        crop_video_path = os.path.join(crops, video_split[0])
        if os.path.exists(crop_video_path):
            shutil.rmtree(crop_video_path)
